<?php get_instance()->view('common/header');?>
<body>
<?php if (!empty($list)): foreach ($list as $k => $v):?>
    <div class="userhuifu bor_bb comment" data-id="<?php echo $v['id']?>">
        <div class="hengleft">
            <div class="minuserimg imgbox"><img src="<?php echo $v['portrait']?>" alt=""></div>
            <div class="">
                <h1><?php echo $v['nickname']?></h1>
                <p class="f07 pjdatatime"><?php echo $v['addtime']?></p>
            </div>
        </div>
        <div class="huifu">
            <p class="m5_0 f09">
                <?php if ($v['parent_id'] > 0):?>
                    回复<span class="hongzi f10"><?php echo $v['parent_name']?>：</span>
                <?php endif;?>
                <?php echo $v['content']?>
            </p>
        </div>
    </div>
<?php endforeach; else:?>
    <div class="statebox chuizhi jdjz" style="flex: 1;height: 63%;">
        <img class="stateimgda mb5" src="<?php echo $this->staticUrl?>img/default/3.png" alt="">
        <span class="f09 cor9 tc mb20">暂无评论</span>
    </div>
<?php endif;?>
<form action="<?php echo getUrl('find/saveComment')?>" id="save-form" method="post">
    <div class="shopcarbox p3p">
        <div class="zan heng vCenter f11 wp100" style="padding-right:5em;">
            <input type="text" class="wenbenpub wp100 p5 required" placeholder="发表评论" name="content">
        </div>
        <div class="btnbox heng vCenter pos" style="right:0;">
            <input type="hidden" value="" name="comment_id">
            <input type="hidden" name="find_id" value="<?php echo $find_id?>">
            <button href="" class="posbotbtn f09 mr5" style="padding:.5em .5em">发送</button>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {
        $.e_validate.init('#save-form',{saveMessage:'保存中...'});

        // 回复
        $(".comment").click(function () {
            var id = $(this).attr('data-id');
            var name = $(this).find('.hengleft').find('h1').html();
            $("[name='comment_id']").val(id);
            $("[name='content']").attr('placeholder', '回复'+name+'：');
            $("[name='content']").focus();
        });

        $("[name='content']").blur(function () {
            var vl = $("[name='content']").val();
            if (!vl.length) {
                $("[name='comment_id']").val(0);
                $("[name='content']").attr('placeholder', '发表评论');
            }
        });
    })
</script>
</html>
